<template>
	<view>
		<u-navbar title="我的" :leftIcon="false">
		</u-navbar>
		<view class="header-section">
			<view class="u-flex u-flex-between" style="align-items: center;">
				<view class="u-flex avatarname">
					<u-avatar :src="userdata.avatar"></u-avatar>
					<view class="user-info">
						<view class="u_title">{{ userdata.nickname||'' }} </view>
						<!-- 	<view class=""> {{ userdata.nickname }} </view> -->
					</view>

				</view>
				<view class="headerbtn">
					<view class="modify" @click="gourl('/pageshome/info/info')">修改资料</view>
				</view>
			</view>
		</view>
		<view class="title">
			常用应用
		</view>
		<view class="listbox">
			<view class="item" v-for="(item,key) in list" :key="key" @click="gourl(item.page)">
				<view class="img">
					<u--image :showLoading="true" :src="item.url" width="60rpx" height="60rpx"></u--image>
				</view>
				<view class="text">
					{{item.text}}
				</view>
			</view>
		</view>
		<tabbar></tabbar>
	</view>
</template>

<script>
	import {
		getUserProfile
	} from "@/api/system/user.js"
	import message from "@/static/images/my/message.png"
	import password from "@/static/images/my/password.png"
	import setup from "@/static/images/my/setup.png"
	export default {
		data() {
			return {
				userdata: {},
				list: [{
						url: message,
						text: '消息通知',
						page: "/pagesmessage/index/index"
					},
					{
						url: password,
						text: '密码修改',
						page: "/pageshome/changePwd/changePwd"
					},
					{
						url: setup,
						text: '设置',
						page: "/pageshome/setting/setting"
					}
				],
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			async init() {
				let userdata = await getUserProfile();
				this.userdata = userdata.data
			},
			gourl(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.headerbtn {
		display: flex;
		flex-direction: column;
		justify-content: center;

		.modify {
			// width: 195rpx;
			// height: 50rpx;
			padding: 6rpx 20rpx;
			display: inline-block;
			background: rgba(255, 255, 255, 0.6);
			box-shadow: 0rpx 6rpx 8rpx 0rpx rgba(30, 81, 181, 0.43);
			border-radius: 25rpx 0rpx 0rpx 25rpx;
			font-size: 24rpx;
			color: #FFFFFF;
			text-align: center;
			margin: 0.3rem -0.5rem 0 0;
			// margin-right: -60rpx;
		}
	}

	.title {
		height: 88rpx;
		display: flex;
		align-items: center;
		padding: 0 20rpx;
		font-size: 28rpx;
	}

	.listbox {
		background: #FFFFFF;
		display: flex;
		flex-wrap: wrap;

		.item {
			width: 25%;
			text-align: center;
			padding: 30rpx 0;

			.img {
				display: flex;
				justify-content: center;
			}

			.text {
				line-height: 40rpx;
				font-size: 28rpx;
				margin-top: 8rpx;
			}
		}
	}

	.header-section {
		padding: 60rpx 30rpx 60rpx 30rpx;
		background-color: #3c96f3;
		color: white;

		.avatarname {
			align-items: center;
		}

		.login-tip {
			font-size: 18px;
			margin-left: 10px;
		}

		.headshot {
			border: 2rpx solid #eaeaea;
			border-radius: 50%;
			width: 140rpx;
			height: 140rpx;
		}

		.user-info {
			margin-left: 15px;

			.u_title {
				font-size: 18px;
				line-height: 30px;
			}
		}
	}
</style>